<template>
  <a-card :bordered="false" :title="'拼团单号：'+queryParam.teamId">
    <!-- 查询区域 -->

    <a-row>
      <a-col :xs="12" :sm="12">
        <a-card title="拼团订单信息" :bordered="false" size="small" style="margin-bottom:15px;">
          <detail-list :col="1">
            <detail-list-item term="拼团状态">{{detail.status==1?'拼团中':detail.status==2?'拼团成功':'拼团失败'}}</detail-list-item>
            <detail-list-item term="发起时间">{{detail.createTime}}</detail-list-item>
            <detail-list-item term="成功时间">{{detail.successTime}}</detail-list-item>
          </detail-list>
        </a-card>
      </a-col>
      <a-col :xs="12" :sm="12">
        <a-card title="拼团商品信息" :bordered="false" size="small" style="margin-bottom:15px;">
          <detail-list :col="1">
            <detail-list-item term="拼团分类">{{detail.categoryName}}</detail-list-item>
            <detail-list-item term="开始时间">{{detail.goodStartTime}}</detail-list-item>
            <detail-list-item term="结束时间">{{detail.goodEndTime}}</detail-list-item>
            <detail-list-item term="商品图片">
              <img :src="detail.adImgUrl" style="height:60px;">
            </detail-list-item>
          </detail-list>
          <detail-list :col="2">
            <detail-list-item term="商品标题">{{detail.title}}</detail-list-item>
            <detail-list-item term="所属店铺">{{detail.shopName}}</detail-list-item>
            <detail-list-item term="拼团单价">{{detail.price}}</detail-list-item>
            <detail-list-item term="拼团原价">{{detail.originalPrice}}</detail-list-item>
            <detail-list-item term="成团人数">{{detail.successNum}}</detail-list-item>
            <detail-list-item term="成团有效期">{{detail.teamTime}}分钟</detail-list-item>
          </detail-list>
        </a-card>
      </a-col>
    </a-row>

    <!-- 查询区域-END -->

    <!-- table区域-begin -->
    <div>

      <a-table ref="table" size="middle" :scroll="{x:true}" bordered rowKey="id" :columns="columns" :dataSource="dataSource" :pagination="ipagination"
        :loading="loading" class="j-table-force-nowrap" @change="handleTableChange">

        <template slot="htmlSlot" slot-scope="text">
          <div v-html="text"></div>
        </template>
        <template slot="priceSlot" slot-scope="">
          <div>{{detail.price}}</div>
        </template>
        <template slot="imgSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
          <img v-else :src="getImgView(text)" height="55px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;" />
        </template>
        <template slot="fileSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
          <a-button v-else :ghost="true" type="primary" icon="download" size="small" @click="downloadFile(text)">
            下载
          </a-button>
        </template>

      </a-table>
    </div>

  </a-card>
</template>

<script>
import { postAction, getAction } from '@/api/manage'
import '@/assets/less/TableExpand.less'
import DetailList from '@/components/tools/DetailList'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/MyJeecgListMixin'
const DetailListItem = DetailList.Item

export default {
  name: 'PtmsTeamMemberList',
  mixins: [JeecgListMixin, mixinDevice],
  components: {
    DetailList, DetailListItem
  },
  data () {
    return {
      description: '拼团订单成员管理页面',
      // 表头
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: "center",
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          }
        },
        {
          title: '昵称',
          align: "center",
          dataIndex: 'nickname'
        },
        {
          title: '手机号',
          align: "center",
          dataIndex: 'phone'
        },
        {
          title: '所属规格',
          align: "center",
          dataIndex: 'skuName'
        },
        {
          title: '拼团单价',
          align: "center",
          dataIndex: 'updateTime',
          scopedSlots: { customRender: 'priceSlot' }
        },
        {
          title: '数量',
          align: "center",
          dataIndex: 'num'
        },
        {
          title: '运费',
          align: "center",
          dataIndex: 'freight'
        },
        {
          title: '余额抵扣',
          align: "center",
          dataIndex: 'balanceDiscount'
        },
        {
          title: '支付金额',
          align: "center",
          dataIndex: 'amount'
        },
        {
          title: '支付方式',
          align: "center",
          dataIndex: 'payChannel_dictText'
        },
        {
          title: '参与时间',
          align: "center",
          dataIndex: 'createTime'
        },

        {
          title: '关联订单号',
          align: "center",
          dataIndex: 'orderNo'
        }

      ],
      url: {
        list: "/mallPlus/omsOrder/ptMemberList",
        queryByPtId: "/mallPlus/omsOrder/queryByPtId"

      },
      dictOptions: {},
      detail: {}
    }
  },
  created () {
    if (this.$route.query.id) {
      this.queryParam['teamId'] = this.$route.query.id
    }
    this.loadInfo()
    this.loadData()

  },
  computed: {
    importExcelUrl: function () {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
    },
  },
  methods: {
    loadInfo () {
      const self = this

      getAction(this.url.queryByPtId, {
        id: this.queryParam.teamId
      }).then(res => {

        self.detail = res.result


      })
    },
    initDictConfig () {
    }
  }
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>